package com.bdcom.autotest.ui.snp;

import com.bdcom.autotest.interaction.step.StepThread;
import com.bdcom.autotest.util.UIUtil;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class PanelForInputWorKNo extends AbsPanel {
	private boolean flag  = false;
	private boolean result  = false;
	public PanelForInputWorKNo(StepThread mainrun) {
		this.setBackground(Color.WHITE);
		this.setPreferredSize(new Dimension( 0 , 250 ));
		JPanel p1 = UIUtil.createPanel();
		Font font2 = new Font("Dialog",Font.PLAIN, 14);
		JLabel jLabel0 = new JLabel( "工单号:");
		jLabel0.setFont(font2);
		JTextField wsn = new JTextField(18);
		wsn.setName("0");
		wsn.setFont(font2);
		wsn.setText("");
		p1.add(jLabel0);
		p1.add(wsn);
		p1.add(Box.createHorizontalStrut(10) );
		JPanel p2 = UIUtil.createPanel();
		JButton btn2 = new JButton("确认");
		btn2.addActionListener( new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				mainrun.getMf().getLeftp().setworkno(wsn.getText());
				flag = true;
				result =true;
			}
		});
		p2.add(Box.createHorizontalStrut( 20 ));
		p2.add(btn2);
		this.add(p1);
		this.add(p2);
	}


	public boolean getTotalResult(){
		while(!flag){
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return result;
	}
}
